import React from 'react';
import AddModal from "./AddModal";
import Lng from "./lng";
import {Button, Modal} from "antd";

class EditModal extends AddModal {

    render() {
        const {visible, loading} = this.state;
        return (
            <Modal
                visible={visible}
                title={Lng.get("common.edit", {name: this.props.titleName})}
                onOk={this.handleOk}
                onCancel={this.handleCancel}
                width={500}
                destroyOnClose={true}
                maskClosable={false}
                footer={[
                    <Button key="back" onClick={this.handleCancel}>{Lng.get("common.cancel", {name: ""})}</Button>,
                    <Button key="submit" type="primary" loading={loading} onClick={this.handleOk}>
                        {Lng.get("common.submit")}
                    </Button>
                ]}
            >
                <this.props.content ref={"form"} id={this.props.id}/>
            </Modal>
        );
    }
}

export default EditModal;